<template>
    <div>
        <div class="crumbs">
            <div class="contentbox">
                <div class="contentsize">事务办件-合同委托签订</div>
                <div>
                    <el-button @click="cacelsubmitForm('ruleForm')">返回</el-button>
                    <!-- <router-link target="_blank" :to="{ path: '/printfilezxgz', params: { id: gdform.id } }"
                        style="padding-right: 12px">
                        <el-button type="text" size="small">打印</el-button>
                    </router-link> -->
                </div>
            </div>
        </div>
        <div class="container">
            <!-- <div class="addtitle">合同委托签订</div> -->
            <!-- 合同委托签订表格 -->
            <div style="width: 70%;margin: auto;">
                <table class="table-1">
                    <!-- 三行三列的表格 -->
                    <tr>
                        <td colspan="4" style="font-weight: 700;padding: 10px;font-size: 20px;">合同委托签订</td>
                    </tr>
                    <tr style="background-color: #F5FAFA;">
                        <td style="text-align: right;font-weight: 700;color: #000;">房屋地址:</td>
                        <td colspan="3">
                            {{ projectdetail.dz }}
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align: right;font-weight: 700;color: #000;">档案号:</td>
                        <td>
                            {{ projectdetail.dabh }}
                        </td>
                        <td style="text-align: right;font-weight: 700;color: #000;">产权单位:</td>
                        <td>
                            {{ projectdetail.cqdw }}
                        </td>
                    </tr>
                    <tr style="background-color: #F5FAFA;">
                        <td style="text-align: right;font-weight: 700;color: #000;">建筑面积:</td>
                        <td>
                            {{ projectdetail.jzmj }}
                        </td>
                        <td style="text-align: right;font-weight: 700;color: #000;">房屋性质:</td>
                        <td>
                            {{ projectdetail.fwyt }}
                        </td>
                    </tr>
                    <!-- 旧数据 -->
                    <tr>
                        <td style="text-align: right;font-weight: 700;color: #000;">受托人:</td>
                        <td>
                            {{ projectdetail.strval }}
                        </td>
                        <!-- <td style="text-align: right;font-weight: 700;color: #000;">受托期限:</td>
                        <td>
                            {{ projectdetail.stqx ? projectdetail.stqx : '0' }}个月
                        </td> -->
                    </tr>
                    <tr>
                        <td style="text-align: right;font-weight: 700;color: #000;">受托起始时间:</td>
                        <td>
                            {{ projectdetail.stqssj?projectdetail.stqssj.split(' ')[0]:'' }}
                        </td>
                        <td style="text-align: right;font-weight: 700;color: #000;">受托到期时间:</td>
                        <td>
                            {{ projectdetail.stdqsj?projectdetail.stdqsj.split(' ')[0]:'' }}
                        </td>
                    </tr>
                    <tr style="background-color: #F5FAFA;">
                        <td style="text-align: right;font-weight: 700;color: #000;">租金分成比例:</td>
                        <td>
                            {{ projectdetail.zjfcbl }}%
                        </td>
                        <td style="text-align: right;font-weight: 700;color: #000;">维修基金比例:</td>
                        <td>
                            {{ projectdetail.wxjjbl }}%
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4" style="font-weight: 700;padding: 10px;font-size: 20px;">----------</td>
                    </tr>
                    <!-- 新数据 -->
                    <tr v-if="projectdetail.htlx == '1'">
                        <td style="text-align: right;font-weight: 700;color: #000;">受托人:</td>
                        <td>
                            {{ projectdetail.xqstrval }}
                        </td>
                        <!-- <td style="text-align: right;font-weight: 700;color: #000;">续期受托期限:</td>
                        <td>
                            {{ projectdetail.xqstqx ? projectdetail.xqstqx : '0' }}个月
                        </td> -->
                    </tr>
                    <tr v-if="projectdetail.htlx == '1'">
                        <td style="text-align: right;font-weight: 700;color: #000;">续期受托起始时间:</td>
                        <td>
                            {{ projectdetail.xqstqssj?projectdetail.xqstqssj.split(' ')[0]:'' }}
                        </td>
                        <td style="text-align: right;font-weight: 700;color: #000;">续期受托到期时间:</td>
                        <td>
                            {{ projectdetail.xqstdqsj?projectdetail.xqstdqsj.split(' ')[0]:'' }}
                        </td>
                    </tr>
                    <tr style="background-color: #F5FAFA;" v-if="projectdetail.htlx == '2'">
                        <td style="text-align: right;font-weight: 700;color: #000;">终止日期:</td>
                        <td>
                            {{ projectdetail.wtzzsj ? projectdetail.wtzzsj.split(' ')[0] : '' }}
                        </td>
                        <td style="text-align: right;font-weight: 700;color: #000;">终止原因:</td>
                        <td>
                            {{ projectdetail.wtzzyy }}
                        </td>
                    </tr>
                    <tr style="background-color: #F5FAFA;">
                        <td style="text-align: right;" v-if="projectdetail.htlx == '1'">续期租金分成比例:</td>
                        <td v-if="projectdetail.htlx == '1'">
                            {{ projectdetail.xqzjfcbl }}%
                        </td>
                        <td style="text-align: right;" v-if="projectdetail.htlx == '1'">续期维修基金比例:</td>
                        <td v-if="projectdetail.htlx == '1'">
                            {{ projectdetail.xqwxjjbl }}%
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align: right;font-weight: 700;color: #000;">经办人签字:</td>
                        <td :colspan="projectdetail.htlx == '1' ? '1' : '3'">
                            {{ projectdetail.jbrqz }}
                        </td>
                        <!-- <td style="text-align: right;font-weight: 700;color: #000;">是否转办件:</td>
                        <td>
                            {{ projectdetail.sfzbj }}
                        </td> -->
                    </tr>
                    <tr>
                        <td style="text-align: right;font-weight: 700;color: #000;">办件事由:</td>
                        <td colspan="3">
                            {{ projectdetail.bjsy }}
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <el-table :data="filetable" style="width: 100%;" border max-height="150">
                                <el-table-column prop="yjbz" label="文件名称" align="center" :show-overflow-tooltip="true"> </el-table-column>
                                <el-table-column prop="yjlx" label="文件类型" align="center"> </el-table-column>
                                <el-table-column prop="wjmc" label="文件预览" align="center" :show-overflow-tooltip="true">
                                    <template slot-scope="scope">
                                        <router-link target="_blank"
                                            :to="{ path: '/perviewfile', query: { id: scope.row.fj[0].id, type: scope.row.fj[0].suffix } }"
                                            style="color: #008A94;"
                                            v-if="scope.row.fj[0].suffix == '.docx' || scope.row.fj[0].suffix == '.doc' || scope.row.fj[0].suffix == '.xls' || scope.row.fj[0].suffix == '.xlsx'">{{
                                                scope.row.wjmc }}<i class="el-icon-document el-icon--right"></i>
                                        </router-link>
                                        <el-button type="text" size="small"
                                            @click="redownload(scope.row.fj[0].id, scope.row.fj[0].name, scope.row.fj[0].suffix)" v-else>{{ scope.row.wjmc }}<i class="el-icon-document el-icon--right"></i></el-button>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="wjmc" label="文件下载" align="center" :show-overflow-tooltip="true">
                                    <template slot-scope="scope">
                                        <el-button type="text" size="small"
                                            @click="downloadfile(scope.row.fj[0].id, scope.row.fj[0].name, scope.row.fj[0].suffix)"
                                            style="color: blue;text-decoration: underline">{{ scope.row.wjmc }}</el-button>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="sfgz" label="是否需要盖章" align="center"> </el-table-column>
                                <el-table-column prop="gzlx" label="盖章类型" align="center"> </el-table-column>
                            </el-table>
                        </td>
                    </tr>
                    <!-- <tr style="background-color: #F5FAFA;">
                    <td colspan="4">
                        <el-button size="mini" type="primary" @click="cacelsubmitForm('ruleForm')">保存</el-button>
                        <el-button size="mini" type="danger" @click="cacelsubmitForm('ruleForm')">删除</el-button>
                        <el-button size="mini" @click="cacelsubmitForm('ruleForm')">返回</el-button>
                    </td>
                </tr> -->

                </table>
            </div>
            <div style="width: 70%;margin:10px auto 0;border: 2px solid #eeeeee;padding: 10px;box-sizing: border-box;" v-if="detailform.zt == 0">
                <el-form ref="yjform" :model="yjform" label-width="auto" :inline="true">
                    <!-- <el-form-item label="修改数据:" prop="wjlx">
                        <div style="width: 180px;">
                            <el-select v-model="gdform.sjxg" placeholder="请选择是否修改数据" style="width: 100%;">
                                <el-option v-for="item in sfxflist" :key="item.code" :label="item.name" :value="item.code">
                                </el-option>
                            </el-select>
                        </div>
                    </el-form-item> -->
                    <el-form-item label="文件类型:" prop="wjlx">
                        <div style="width: 180px;">
                            <el-cascader
                                :options="yjlxlist"
                                :show-all-levels="false"
                                v-model="yjlx"
                                placeholder="请选择文件类型"
                                :props="{ checkStrictly: true }"
                            ></el-cascader>
                            <!-- <el-select v-model="yjform.wjlx" placeholder="请选择文件类型" style="width: 100%;">
                                <el-option v-for="item in yjlxlist" :key="item.code" :label="item.name" :value="item.code">
                                </el-option>
                            </el-select> -->
                        </div>
                    </el-form-item>
                    <el-form-item label="文件名称:" prop="bz">
                        <div style="width: 180px;">
                            <el-input placeholder="请输入文件名称" v-model="yjform.bz" style="width: 100%;"></el-input>
                        </div>
                    </el-form-item>
                    <!-- <el-form-item label="是否需要盖章:" prop="sfgz">
                        <div style="width: 180px;">
                            <el-select v-model="yjform.sfgz" placeholder="请选择是否需要盖章" style="width: 100%;">
                                <el-option v-for="item in sflist" :key="item.code" :label="item.name" :value="item.code">
                                </el-option>
                            </el-select>
                        </div>
                    </el-form-item> -->
                    <el-upload class="upload-demo" :action="httpUrl + '/file/uploadFile'" :on-remove="handleRemoves"
                        :before-remove="beforeRemoves" multiple :on-success="handelfilesuccess" :headers="myHeaders"
                        :file-list="filefileList">
                        <div class="unloadTitle">附件</div>
                        <el-button size="small" icon="el-icon-upload2">上传文件</el-button>
                    </el-upload>
                </el-form>
                <div style="width: 220px;margin: auto;">
                    <el-button type="primary" @click="submitForm" v-if="fileLists.length != 0">上传</el-button>
                </div>
                <el-table :data="yjtableData" style="width: 100%;margin: 30px auto 0;" border>
                    <el-table-column prop="wjlx" label="文件类型" align="center"></el-table-column>
                    <el-table-column prop="wjmc" label="文件" align="center"> </el-table-column>
                    <!-- <el-table-column prop="sfgz" label="是否需要盖章" align="center"> </el-table-column> -->
                    <el-table-column prop="bz" label="文件名称" align="center"> </el-table-column>
                    <el-table-column prop="sfbcw" label="是否上报财务" align="center">
                        <template slot-scope="scope">
                            <el-switch
                                v-model="scope.row.sfbcw"
                                active-color="#13ce66"
                                inactive-color="#ff4949"
                                active-value="1"
                                inactive-value="0"
                            >
                            </el-switch>
                        </template>
                    </el-table-column>
                    <!-- <el-table-column prop="sfbyy" label="是否上报运营" align="center">
                        <template slot-scope="scope">
                            <el-switch
                                v-model="scope.row.sfbyy"
                                active-color="#13ce66"
                                inactive-color="#ff4949"
                                active-value="1"
                                inactive-value="0"
                            >
                            </el-switch>
                        </template>
                    </el-table-column> -->
                    <el-table-column label="操作" width="100" align="center">
                        <template slot-scope="scope">
                            <el-button type="text" size="small" @click.native.prevent="deleteRow(scope.$index, yjtableData)"
                                style="color: red">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div style="width: 100px;margin: 16px auto;">
                    <!--  v-if="gdform.gdfjlist!=0" -->
                    <el-button size="mini" type="primary" @click="getgd">保存</el-button>
                </div>
            </div>
            <!-- <div style="width: 70%;margin:10px auto 0;">
                <table class="table-1">
                    <tr>
                        <td style="text-align: right;font-weight: 700;color: #000;">归档记录:</td>
                        <td colspan="3">
                            <el-input v-model="gdform.gdjl" placeholder="请输入归档记录" class="search-input"></el-input>
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align: right;font-weight: 700;color: #000;">附件</td>
                        <td colspan="3" style="text-align: left;" v-if="detailform.zt == 0">
                            <el-upload class="upload-demo" :action="httpUrl + '/file/uploadFile'" :on-remove="handleRemoves"
                                :before-remove="beforeRemoves" multiple :on-success="handelfilesuccess" :headers="myHeaders"
                                :file-list="filefileList">
                                <el-button size="small" icon="el-icon-upload2">上传文件</el-button>
                            </el-upload>
                        </td>
                        <td colspan="3" style="text-align: left;" v-else>
                            <div style="display:flex;margin-top: 20px;width: 750px;flex-wrap: wrap;flex-direction: row;">
                                <div style=" text-align: center;margin-right:10px;cursor: pointer;width: 100px;"
                                    v-for="(item, index) in detailform.fjlist" :key="index" class="filebox">
                                    <img src="@/assets/img/file.png" alt="" style="width:50px;height:60px;"
                                        @click="downloadfile(item.id, item.name, item.suffix)">
                                    <div class="fileboxitem">{{ item.name }}</div>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <td colspan="4" v-if="detailform.zt == 0">
                        <el-button size="mini" type="primary" @click="getgd">保存</el-button>
                        <el-button size="mini" @click="cacelsubmitForm('ruleForm')">返回</el-button>
                    </td>
                </table>
            </div> -->
            <!-- <el-table :data="tableData" style="width: 70%;margin: 30px auto 0;" border>
                <el-table-column prop="sssw" label="所属事务名称" align="center"> </el-table-column>
                <el-table-column prop="zjrname" label="转件人" align="center"> </el-table-column>
                <el-table-column prop="zjrq" label="转件日期" align="center">
                    <template slot-scope="scope">
                        {{ scope.row.zjrq ? scope.row.zjrq.split(' ')[0] : '' }}
                    </template>
                </el-table-column>
                <el-table-column prop="bz" label="步骤" align="center"> </el-table-column>
                <el-table-column prop="cz" label="操作" align="center"> </el-table-column>
                <el-table-column prop="clyj" label="处理意见" align="center"> </el-table-column>
                <el-table-column prop="zd" label="转到" align="center"> </el-table-column>
            </el-table> -->
            <!-- <div class="pagination" style="float: right">
                <el-pagination background layout="total,prev, pager, next,jumper" :total="total" :current-page.sync="current"
                    :page-size="pageSize" @current-change="handleCurrentChange">
                </el-pagination>
            </div> -->
        </div>
        <!-- <div>
            <embed :src="pdfUrl" width="100%" height="600px">
        </div> -->
        <!-- <el-dialog title="文件" :visible.sync="yjshow" :modal-append-to-body="false" width="80%">
            <el-form ref="yjform" :model="yjform" label-width="auto" :inline="true">
                <el-form-item label="文件类型:" prop="yjlx">
                    <el-select v-model="yjform.yjlx" placeholder="请选择文件类型" style="width: 100%;">
                        <el-option v-for="item in yjlxlist" :key="item.code" :label="item.name" :value="item.code">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="文件名称:" prop="yjbz">
                    <el-input placeholder="请输入文件名称" v-model="yjform.yjbz" style="width: 100%;"></el-input>
                </el-form-item>
                <el-upload class="upload-demo" :action="httpUrl + '/file/uploadFile'" :on-remove="handleRemoves"
                    :before-remove="beforeRemoves" multiple :on-success="handelfilesuccess" :headers="myHeaders"
                    :file-list="filefileList">
                    <div class="unloadTitle">附件</div>
                    <el-button size="small" icon="el-icon-upload2">上传文件</el-button>
                </el-upload>
            </el-form>
            <div style="width: 220px;margin: auto;">
                <el-button type="primary" @click="submitForm" v-if="fileLists.length != 0">上传</el-button>
                <el-button @click="yjshow = false">关闭</el-button>
            </div>
            <el-table :data="yjtableData" style="width: 100%;margin: 30px auto 0;" border>
                <el-table-column prop="yjlx" label="文件类别" align="center"></el-table-column>
                <el-table-column prop="wjmc" label="文件" align="center"> </el-table-column>
                <el-table-column prop="yjbz" label="文件名称" align="center"> </el-table-column>
                <el-table-column label="操作" width="100" align="center">
                    <template slot-scope="scope">
                        <el-button type="text" size="small" @click.native.prevent="deleteRow(scope.$index, yjtableData)"
                            style="color: red">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </el-dialog> -->

    </div>
</template>
<script>
import { gddetails, download, caselist, lccheck, buildlist, getbuilddetailbydabh, wjgdupdate,redownload,wtdwlist,dbnum } from '@/api/index';
import fileType from "../vo/filetype";
import valueList from '@/components/common/valueList.vue'
import global from '@/components/common/httpurl.vue'
export default {
    name: 'zxgzgd',
    data() {
        return {
            yjlx:[],
            sfxflist:[{name:'是',code:'1'},{name:'否',code:'0'}],
            activeName: 'first',
            options: [],//测试
            yjlxlist: valueList.yjlxlist,//是否列表
            yjdeepcolor: null,
            yjshow: false,//文件弹框
            yjform: {},//文件表单
            jgxslist: valueList.jgxslist,
            qslist: valueList.qslist,
            fwytlist: valueList.fwytlist,
            cblist: valueList.cblist,
            cqdwlist: valueList.cqdwlist,
            sflist: valueList.sflist,//是否列表
            myHeaders: {
                'token': localStorage.getItem('token')
            },
            filefileList: [],
            httpUrl: global.httpUrl,//公共地址
            form: {
                clyj: '',//处理意见
                id: '',
                nextnodeid: '',//选择下一步节点id 
                selectuser: '',//下一步选择用户id 
                zt: 1//通过驳回 0：驳回 1：通过
            },
            detailform: {},//获取详情数据
            projectdetail: {},
            fileList: [],
            fileType: fileType,
            tableData: [],
            yjtableData: [],
            filetable: [],//文件列表
            total: 0,
            current: 1,
            pageSize: 10,
            xcnr: [],
            yjlist: ['同意', '不同意', '同意，请认真办理！', '不同意，请认真复核！', '拟同意，请领导批示！', '请办公室盖章！', '已盖章', '已办理，请归档！'],
            fileLists: [],//文件列表
            czlist: [],//操作列表
            sflists: [{ name: '是', value: '1' }, { name: '否', value: '0' }],//是否
            userlist: [],//部门列表
            userlistht: [],//部门列表
            hqshow: false,//会签按钮显示隐藏,
            fileform: {
                caseid: '',
                pageSize: 100,
                current: 1,
            },
            lzform: {
                cb: "",
                cqdw: "",
                create_name: "",
                create_name_id: "",
                create_time: "",
                current: 0,
                dabh: "",
                dscs: "",
                dxcs: "",
                fmjz: "",
                fwdz: "",
                fwjg: "",
                fwyt: "",
                fzrq: "",
                id: "",
                jdrq: "",
                jzmj: "",
                jzmja: "",
                jzmjb: "",
                jznd: "",
                jzxs: "",
                note: "",
                pageSize: 999,
                qs: "",
                qzlx: "",
                status_code: 0,
                tdsyqlx: "",
                tdsyqmj: "",
                update_name: "",
                update_name_id: "",
                update_time: "",
                yz: "",
                zlc: "",
                zsbh: "",
                zsxyl: "",
                gfdw: this.$store.getters.gfdw,
                fczt: '1'
            },
            lzlist: [],//楼幢列表,
            gdform: {
                sjxg:'1',//是否修改
                gdfjlist:[],
                gdjl: '',
                id:''
            },//归档表单
            pdfUrl: '',
            wtdwlists: [],//委托单位
            wtdwform: {
                create_time: '',//创建时间 ,
                current: 1,//第几页 ,
                dwbh: '',//单位编号 ,
                dwmc: '',//单位名称 ,
                id: '',//id ,
                lxdh: '',// 联系电话 ,
                lxr: '',//联系人 ,
                pageSize: 999,//每页数量 ,
                status_code: 1,//1正常 2删除
                tght: '',//托管合同 ,
                yyzz: '',//营业执照
            },
        };
    },
    methods: {
        // 选中一个的值
        searchChangeitem(val) {
            console.log(val)
        },
        // 单选一个的测试
        searchChange() {
            if (this.options.length > 1) {
                this.options.splice(0, 1)
            }
        },
        // 点击获取人员列表
        getry(val) {
            this.userlist = val.userlist
        },
        // 点击获取人员列表(回退)
        getryht(val) {
            console.log(val)
            this.userlistht = val.userlist
        },
        // 换页
        handleCurrentChange(val) {
            this.current = val;
            this.form.current = val;
            this.buildlist(this.form);
            console.log(val);
        },
        // 返回上一页
        backForm() {
            this.$router.go(-1);
        },
        // 楼幢详情
        // ishq (integer, optional): 是否会签开始节点 ,
        // isstartend (integer, optional): 是否首尾节点 0：否 1：首节点 2：结束节点 ,
        // isth (integer, optional): 是否可退回 ,
        gddetails(data) {
            gddetails(data).then((res) => {
                console.log('res', res)
                this.detailform = res.data;//全部数据
                this.gdform.gdjl = res.data.gdjl;
                this.projectdetail = res.data.processtableInfo;//已录入数据
                this.tableData = res.data.nodeList;
                this.fileform.caseid = res.data.caseid;
                this.form.id = res.data.id;
                this.caselist(this.fileform)

                let strdata=this.wtdwlists.find(item=>{
                    return item.id==this.projectdetail.str
                })
                this.projectdetail.strval=strdata.dwmc

                let xqstrdata=this.wtdwlists.find(item=>{
                    return item.id==this.projectdetail.xqstr
                })
                this.projectdetail.xqstrval=xqstrdata.dwmc
            });
        },
        // 流程文件列表
        caselist(data) {
            caselist(data).then(res => {
                this.filetable = res.data
                this.yjtableData = res.data.map((item) => {
                    if (item.sfgz == '否') {
                        return {
                            caseid: '', // 流程实例id ,
                            create_name: '', //创建人 ,
                            create_name_id: '', //创建人id ,
                            create_time: '', //创建时间 ,
                            fj: item.fj[0].id, //附件
                            id: '', // id ,
                            status_code: '1', // 1正常 2删除 ,
                            update_name: '', // 修改人 ,
                            update_name_id: '', //修改人id ,
                            update_time: '', //修改时间 ,
                            wjmc: item.wjmc, //文件名称 ,
                            bz: item.yjbz?item.yjbz:item.wjmc, //文件名称 ,
                            wjlx: item.yjlx,
                            sfbcw:'0', //是否上报财务
                            sfbyy:'0' //是否上报运营
                        };
                    }
                }).filter(Boolean);
                this.gdform.gdfjlist = this.yjtableData;
                console.log('filelist', res)
            })
        },
        // 流程审批
        lccheck(data) {
            lccheck(data).then(res => {
                if (res.code == 200) {
                    this.$message.success('审批通过')
                    let userid = this.$store.getters.userId
                    this.dbnum(userid)
                    this.$router.go(-1);
                }
            })
        },
        // 待办数据
        dbnum(data) {
            dbnum(data).then(res => {
                console.log('待办', res)
                this.$store.commit('handledbnum1', res.data.swnum)
                this.$store.commit('handledbnum2', res.data.gdnum)
                this.$store.commit('handledbnum4', res.data.wtswnum)
            })
        },
        // 下一步操作按钮
        nextstep() {
            var that = this
            console.log(this.form)
            if (this.detailform.isstartend == 1) {
                this.form.processtableInfo = this.projectdetail;
                this.form.fileList = this.yjtableData;
            }
            // 先判断是否会签（会签不用选人员）
            if (this.detailform.ishq == 0) {
                // 判断是否是最后一个节点（最后一个节点不用选人员）
                if (that.detailform.isstartend == 2) {
                    that.lccheck(that.form)
                } else {
                    if (that.form.selectuser) {
                        that.lccheck(that.form)
                    } else {
                        that.$message.error('请选择人员！！！');
                    }
                }
            } else {
                this.form.nextnodeid = this.options.toString()
                this.lccheck(this.form)
                console.log(this.form)
            }
        },
        // 下一步回退
        nextstepht() {
            this.form.zt = 0
            if (this.form.selectuser) {
                this.lccheck(this.form)
            } else {
                this.$message.error('请选择人员！！！');
            }
        },
        // 下载文件
        downloadfile(id, name, type) {
            console.log(id)
            let filetype = fileType[type];
            let data = {
                fileid: id
            }
            download(data).then(res => {
                const link = document.createElement('a');
                let blob = new Blob([res], {
                    type: filetype
                });
                link.style.display = 'none';
                //设置连接
                link.href = URL.createObjectURL(blob);
                link.download = name;
                document.body.appendChild(link);
                //模拟点击事件
                link.click();
                console.log(res)

                // 测试预览功能
                // const file = new Blob([res], { type: filetype })
                // const fileUrl = URL.createObjectURL(file)
                // this.pdfUrl = fileUrl
                // console.log(this.pdfUrl)
            })
        },
        // 文件预览
        redownload(id, name, type) {
            let filetype = fileType[type];
            let data = {
                fileid: id
            }
            redownload(data).then(res => {
                console.log(res)
                let blob = new Blob([res], {
                    type: filetype
                });
                let url = window.URL.createObjectURL(blob);
                window.open(url, '_blank')
            })
        },
        // 文件
        handleRemoves(file, fileList) {
            console.log(fileList)
            this.fileLists = fileLists
            // this.fileListshandle = fileList.map((res) => {
            //     return res.response.data.id;
            // });
            // this.gdform.fj = this.fileListshandle.toString()
        },
        // 文件删除前
        beforeRemoves(file, fileList) {
            console.log(file)
            console.log(fileList)
            return this.$confirm(`确定移除 ${file.name}？`);
        },
        // 上传成功
        handelfilesuccess(response, file, fileLists) {
            console.log(fileLists)
            this.fileLists = fileLists
            // this.fileListshandle = fileLists.map((res) => {
            //     console.log(res.response.data)
            //     return res.response.data.id;
            // });
            // this.gdform.fj = this.fileListshandle.toString()
        },
        // 获取到每一个意见值
        getYjVal(val, i) {
            this.yjdeepcolor = i
            console.log(val)
            this.form.clyj = val
        },
        // 取消
        cacelsubmitForm() {
            this.$router.go(-1);
        },
        // 跳转文件
        gotoyaojian() {
            this.yjshow = true
        },
        // 删除
        deleteRow(index, rows) {
            this.$confirm('确定删除此条文件吗？')
                .then(() => {
                    rows.splice(index, 1);
                })
                .catch(() => {
                    this.$message.success('删除取消');
                });
        },
        // 上传功能
        submitForm() {
            console.log('wjlx', this.yjform.wjlx)
            console.log('bz', this.yjform.bz)
            console.log('fileLists', this.fileLists)
            if (this.yjlx) {
                var lastItem = this.yjlx[this.yjlx.length - 1]
                this.yjform.wjlx = lastItem
                //this.yjform.yjlx=this.yjform.yjlx.pop();

            } else {
                this.$message.error('请选择文件类型');
                return
            }
            // 类型 suffix
            let yjlb = this.fileLists.map(res => {
                return {
                    caseid: '',// 流程实例id ,
                    create_name: '',//创建人 ,
                    create_name_id: '',//创建人id ,
                    create_time: '',//创建时间 ,
                    fj: res.response.data.id,//附件
                    id: '',// id ,
                    status_code: '1',// 1正常 2删除 ,
                    update_name: '',// 修改人 ,
                    update_name_id: '',//修改人id ,
                    update_time: '',//修改时间 ,
                    wjmc: res.response.data.filename,//文件名称 ,
                    bz: this.yjform.bz,//文件名称 ,
                    wjlx: this.yjform.wjlx,//文件类型
                    sfbcw:'0', //是否上报财务
                    sfbyy:'0' //是否上报运营
                }
            })
            console.log('yjlb', yjlb)
            this.yjtableData = this.yjtableData.concat(yjlb)
            this.yjform.wjlx = null;
            this.yjform.bz = null;
            this.yjlx= null;
            this.filefileList = [];
            this.fileLists = [];
            this.gdform.gdfjlist=this.yjtableData
        },
        // 选项卡
        handleClick(tab, event) {
            console.log(tab, event);
        },
        // 楼幢
        buildlist(data) {
            buildlist(data).then((res) => {
                if (res.code == 200) {
                    this.lzlist = res.data.records;
                } else {
                    this.lzlist = [];
                }
            });
        },
        // 获取楼幢信息
        getbuildval(val) {
            console.log('楼幢详情', val)
            let data = {
                dabh: val
            }
            getbuilddetailbydabh(data).then(res => {
                console.log(res)
                this.form.processtableInfo.dabh = res.data.dabh
                this.form.processtableInfo.fwzldw = res.data.fwzldw
                this.form.processtableInfo.dz = res.data.fwdz
                this.form.processtableInfo.fwyt = res.data.fwyt
                this.form.processtableInfo.jzmj = res.data.jzmj
                this.form.processtableInfo.buildid =res.data.id
            })
        },
        // 归档接口
        wjgdupdate(data) {
            wjgdupdate(data).then(res => {
                if (res.code == 200) {
                    this.$message.success('已归档！！！')
                    this.$router.go(-1);
                }
            })
        },
        // 归档
        getgd() {
            console.log(this.gdform)
            this.wjgdupdate(this.gdform)
        },
        // 委托单位列表
        wtdwlist(data) {
            wtdwlist(data).then((res) => {
                if (res.code == 200) {
                    this.wtdwlists = res.data.records;
                }
            });
        }
    },
    mounted() {
        this.buildlist(this.lzform)
        let data = {
            id: this.$route.params.id
        };
        this.gddetails(data);
        this.gdform.id = this.$route.params.id
        this.wtdwlist(this.wtdwform)
    }
};
</script>
<style>
.el-upload-list {
    width: 60%;
}

.el-upload--text {
    width: auto;
    height: 80px;
    overflow: hidden;
    border: none;
}
</style>
<style scoped>
/* 选择意见 */
.xzyj {
    width: 48%;
    height: 110px;
    overflow-y: scroll;
    overflow-x: hidden;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    padding: 10px 0;
    box-sizing: border-box;
}

.xzyj .xzyjitem {
    text-align: left;
    cursor: pointer;
    line-height: 24px;
}

table {
    width: 100%;
    margin: auto;
    text-align: center;
}

.table-1 {
    border: 1px solid #c0c0c0;
    border-collapse: collapse;
    /*合并相邻表格的间距*/

}

.table-1 tr,
.table-1 td {
    font-size: 13px;
    border-collapse: collapse;
    border: 1px solid #c0c0c0;
    padding: 10px;
    box-sizing: border-box;
    color: #606266;
}

.container {
    overflow: hidden;
}

.crumbs {
    background-color: #fff;
    padding: 20px 20px;
}

.indexTitle {
    margin-bottom: 20px;
}

.contentbox {
    display: flex;
    justify-content: space-between;
}

.contentsize {
    font-size: 18px;
    font-weight: 700;
    line-height: 32px;
    color: #606266;
}

.handle-box {
    overflow: hidden;
}

.addtitle {
    width: 100%;
    border-bottom: 1px solid #eeeeee;
    padding-bottom: 20px;
    box-sizing: border-box;
    margin-bottom: 20px;
    font-weight: 700;
}

.buttonCenter {
    width: 12%;
    margin: auto;
}

.unloadTitle {
    text-align: left;
    padding-bottom: 10px;
    box-sizing: border-box;
    color: #606266;
}

/* 搜索按钮 */
.searchcolor {
    background-color: #7090ff;
}

.detailcontent {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.detailcontent .detailitem {
    /* float: left; */
    width: 33%;
    margin-bottom: 30px;
}

.detailcontent .detailitem1 {
    /* float: left; */
    width: 99%;
    margin-bottom: 30px;
    font-weight: 700;
    color: #008A94;
}

.detailcontent .detailitem2 {
    /* float: left; */
    width: 99%;
    margin-bottom: 30px;
}

/* 项目文件 */
.filebox {
    text-align: center;
    margin-right: 10px;
    cursor: pointer;
}

.fileboxitem:hover {
    color: #7090ff;
}

.deleteitem {
    color: red;
}

.deleteitem:hover {
    color: #eeeeee;
}
</style>